
	clear
	cd ""
	tempfile clear
	set more off

	set scheme plotplainblind

* Read in US Economic and Military Aid Data
	clear
	import excel "Total_Economic_and_Military_Assistance_1946-2013.xlsx", sheet("Economic and Military Aid") cellrange(A7:I56600) firstrow case(lower)
	encode assistancecategory, gen(aidtype)
	keep if aidtype == 1 | aidtype == 2
	drop if fiscalyear == 1976.9
	drop fundingaccountname obligationshistoricaldollars region publicationrow fundingagency assistancecategory
	kountry country, from(other)  stuck
	rename _ISO3N_ ccode
	kountry ccode, from(iso3n) to(cown)
	drop ccode
	rename _COWN_ ccode
	replace ccode = 710 if country == "China (P.R.C.)"
	replace ccode = 713 if country == "China (Taiwan)"
	replace ccode = 341 if country == "Montenegro"
	replace ccode = 343 if country == "Macedonia, Former Yugoslav Republic"
	replace ccode = 345 if country == "Serbia and Montenegro, Former"
	replace ccode = 347 if country == "Kosovo"
	replace ccode = 626 if country == "South Sudan"
	drop if ccode == .
	rename obligationsconstantdollars aid
	rename fiscalyear year
	sort ccode year	
	collapse (sum) aid, by(ccode year aidtype)
	duplicates drop ccode year aidtype, force
	keep if year>=1950
	
			reshape wide aid, i(ccode year) j(aidtype) 

	rename aid1 aid_econ
	rename aid2 aid_mil
	replace aid_econ = 0 if aid_econ == .
	replace aid_mil = 0 if aid_mil == .
	
	format aid_* %14.0fc
	replace aid_econ = aid_econ/1000000
	replace aid_mil = aid_mil/1000000


	twoway connected aid_econ year if ccode == 100, lpattern(solid) msym(D) mfcolor() ///
	|| connected aid_econ year if ccode == 95, lpattern(solid) msym(S) mfcolor() ///
	|| connected aid_econ year if ccode == 135, lpattern(solid) msym(O) mfcolor() ///
	ytitle(Millions of 2014 Dollars) ///
	xtitle(Year) ///
	xlab(1950(10)2015) ///
	legend(lab(1 "Colombia") lab(2 "Panama") lab(3 "Peru") pos(6) cols(3) ring(1) symxsize(5) size(small)) ///
	title("A") ///
	name(econaid, replace)

	graph export "US Economic Aid.pdf", replace
	
	twoway connected aid_mil year if ccode == 100, lpattern(solid) msym(D) mfcolor() ///
	|| connected aid_mil year if ccode == 95,lpattern(solid) msym(S) mfcolor() ///
	|| connected aid_mil year if ccode == 135, lpattern(solid) msym(O) mfcolor()  ///
	ytitle(Millions of 2014 Dollars) ///
	xtitle(Year) ///
	xlab(1950(10)2015) ///
	legend(lab(1 "Colombia") lab(2 "Panama") lab(3 "Peru") pos(11) ring(0)) ///
	title("B") ///
	name(milaid, replace)

	graph export "US Military Aid.pdf", replace
	
	grc1leg econaid milaid, cols(2) legendfrom(econaid) ring(1) pos(6) name(aidcombined, replace) 
	graph display aidcombined, xsize(7) ysize(4) scale(1.2) margin(0 0 0 0)
	graph export "US Aid Combined.pdf", replace
	
